import java.math.BigInteger;
import java.sql.Struct;
import java.util.Arrays;
import java.util.Scanner;

class Person {
    String name;
    int age;
    public void sleep() {
        System.out.println(name + "在睡觉");
    }
    public void setPer(String name, int age) {
        this.name = name;
        this.age = age;
//        name = name;//error 局部变量优先 所以前面的name不是对象（外面）的，而是里面的
//        age = age;//
    }

}

public class Test2 {
    public static void main8(String[] args) {
        String s = "123 456";
        BigInteger bigInteger = new BigInteger("1235412");
        bigInteger = bigInteger.add(bigInteger);
        char[] arr = s.toCharArray();
        int num = Integer.valueOf("123");
        String[] str = s.split(" ");
    }
    public static void main7(String[] args) {
        Person person = new Person();
        person.setPer("hua", 14);
        person.sleep();
    }
    public static void main6(String[] args) {
        Scanner in = new Scanner(System.in);
        int[][] arr = {{1, 2}, {3}, {5}};
        System.out.println(Arrays.deepToString(arr));
//        int[] arr2 = Arrays.copyOf(arr, arr.length * 2);
//        System.out.println(Arrays.toString(arr2));
    }
    public static void main5(String[] args) {
        int[] arr = {1,1,1,1,2,3,33,3,3,3,3,3,3,3,1,5};
        int ret = findNum(arr);
        System.out.println(ret);
    }
    public static int findNum(int[] arr) {
        int count = 1;
        int ret = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if(arr[i] != ret) {
                if(count == 0) {
                    count = 1;
                    ret = arr[i];
                } else {
                    count--;
                }
            } else {
                count++;
            }
        }
        return ret;
    }
    public static int[] findNums(int[] arr, int n) {
        int len = arr.length;
        int min = arr[0];
        int max = arr[0];
        int[] ret = new int[]{-1, -1};
        for (int i = 0; i < len; i++) {
            if(min > arr[i]) {
                min = arr[i];
            }
            if(max < arr[i]) {
                max = arr[i];
            }
        }
        int[] arr1 = new int[len];

        for (int i = 0; i < len; i++) {
            if(arr[i] + max < n || arr[i] + min > n) {
                arr1[i] = 1;
            }
        }
        for (int i = 0; i < len && arr1[i] != 1; i++) {
            for (int j = i + 1; j < len && arr1[i] != 1; j++) {
                if(arr[i] + arr[j] == n) {
                    ret[0] = i;
                    ret[1] = j;
                    return ret;
                }
            }
        }
        return ret;
    }
    public static void main4(String[] args) {
        int k = 100;
        int[] arr = new int[k];
        k = 1;
    }
    public static int find(int[] arr, int n) {
        int l = 0;
        int r = arr.length - 1;
        while(l <= r) {
            int mid = l + (r - l) / 2;
            if(arr[mid] == n) {
                return mid;
            } else if (arr[mid] < n) {
                l = mid + 1;
            } else {
                r = mid - 1;
            }
        }
        return -1;
    }
    public static void main2(String[] args) {
        int[] arr = {1,3,4,5,8,100};
        int index = find(arr, 5);
        System.out.println(index);
        index = find(arr, 3);
        System.out.println(index);
        index = find(arr, 8);
        System.out.println(index);
    }
    public static void p(int[] arr) {
        int l = 0;
        int r = arr.length - 1;
        while(l < r) {
            int flag1 = 0;
            int flag2 = 0;
            if(arr[l] % 2 == 0 && (arr[r] & 1) == 1) {
                int t = arr[l];
                arr[l] = arr[r];
                arr[r] = t;
                l++;
                r--;
            }
            if(arr[l] % 2 == 0) {
                l--;
            }
            if((arr[r] & 1) == 1) {
                r++;
            }
            l++;
            r--;
        }
    }
    public static void p2(int[] arr) {
        int l = 0;
        int r = arr.length - 1;
        while(l < r) {
            while(l < r && arr[l] % 2 == 1) {
                l++;
            }
            while(l < r && arr[r] % 2 == 0)  {
                r--;
            }
            int t = arr[l];
            arr[l] = arr[r];
            arr[r] = t;
        }
    }
    public static void transform(int[] arr) {
        for(int i = 0; i < arr.length; i++) {
            arr[i] += arr[i];
        }
    }
    public static void han(int n, char a, char b, char c) {
        if(n == 1) {
            System.out.println(a + "->" + c);
            return;
        }
        han(n - 1, a, c, b);
        System.out.println(a + "->" + c);
        han(n - 1, b, a, c);
    }
    public static void main1(String[] args) {
//        han(3, 'a', 'b', 'c');
        int[] arr = {1,2,3,4,5};
//        transform(arr);
        p2(arr);
        for(int x : arr) {
            System.out.println(x);
        }
    }
}
